<!--  -->
<template>
  <div class="inoculant">
    <van-row>
      <van-col span="12" class="txt">姓名：{{ data.name }}</van-col>
      <van-col span="12" class="txt">出生日期：{{ data.birthday }}</van-col>
      <van-col span="12" class="txt">联系方式：{{ data.phone }}</van-col>
    </van-row>
    <i class="iconfont iconshanchu" @click="remove"></i>
  </div>
</template>

<script>
import { removeInoculationUser } from "@/api/user";

export default {
  components: {},
  data() {
    return {};
  },
  props: {
    data: {}
  },
  //方法集合
  methods: {
    remove() {
      this.$dialog.confirm({
        title: "提示",
        message: `是否确认删除接种人${this.data.name}？`,
        beforeClose: this.beforeClose
      });
    },
    beforeClose(action, done) {
      const { inoculationPersonId } = this.data;
      if (action === "confirm") {
        removeInoculationUser({
          inoculationPersonId
        })
          .then(res => {
            this.$notify({ type: "success", message: "删除成功！" });
            done();
            this.$emit('remove')
          })
          .catch(err => {
            done(false);
          });
        setTimeout(() => {}, 1000);
      } else {
        done();
      }
    }
  },
  created() {},
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {}
};
</script>
<style lang='scss' scoped>
.inoculant {
  position: relative;
  padding: 0.4rem /* 30/75 */;
  background: #ffffff;
  font-size: 0.32rem /* 24/75 */;
  margin-bottom: 0.27rem /* 20/75 */;
  .txt {
    margin-bottom: 0.16rem /* 12/75 */;
  }
  .iconfont {
    position: absolute;
    right: 0.27rem /* 20/75 */;
    bottom: 0.27rem /* 20/75 */;
    color: $baseColor;
  }
}
</style>